<div class="layuimini-main">
  <div class="layui-form layuimini-form">
    <div class="layui-form-item">
      <label class="layui-form-label required">考点名称</label>
      <div class="layui-input-block">
        <input type="text" name="username" lay-verify="required" lay-reqtext="考点名称不能为空" placeholder="请输入考点名称" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">计划类别</label>
      <div class="layui-input-block">
        <select name="interest" lay-filter="aihao">
          <option value=""></option>
          <option value="0">写作</option>
          <option value="1" selected="">阅读</option>
          <option value="2">游戏</option>
          <option value="3">音乐</option>
          <option value="4">旅行</option>
        </select>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label required">考试类别</label>
      <div class="layui-input-block">
        <input name="phone" lay-verify="required" lay-reqtext="考试类别" placeholder="请输入考试类别" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">考试总人数</label>
      <div class="layui-input-block">
        <input type="email" name="email" placeholder="请输入考试总人数" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">考试日期</label>
      <div class="layui-input-inline">
        <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">保存</button>
        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">取消</button>
      </div>
    </div>
  </div>
</div>
<script>
  layui.use(['form', 'table', 'laydate'], function () {
    var form = layui.form,
      layer = layui.layer,
      table = layui.table,
      laydate = layui.laydate,
      $ = layui.$;

    /**
     * 初始化表单，要加上，不然刷新部分组件可能会不加载
     */
    form.render();

    laydate.render({
      elem: '#date'
    });

    // 当前弹出层，防止ID被覆盖
    var parentIndex = layer.index;

    //监听提交
    form.on('submit(saveBtn)', function (data) {
      var index = layer.alert(JSON.stringify(data.field), {
        title: '最终的提交信息'
      }, function () {

        // 关闭弹出层
        layer.close(index);
        layer.close(parentIndex);

      });


      return false;
    });

  });
</script>
